package net.stogi.dsper.ui.client.module.login;

import net.stogi.common.security.dto.PrincipalData;

import com.google.gwt.event.shared.GwtEvent;

public class UserLoggedInEvent extends GwtEvent<UserLoggedInHandler> {

	public static final GwtEvent.Type<UserLoggedInHandler> TYPE = new GwtEvent.Type<UserLoggedInHandler>();

	private PrincipalData principalData;

	public UserLoggedInEvent(PrincipalData principalData) {
		this.principalData = principalData;
	}

	protected UserLoggedInEvent() {}

	@Override
	public Type<UserLoggedInHandler> getAssociatedType() {
		return TYPE;
	}

	/**
	 * @return the principalData
	 */
	public PrincipalData getPrincipalData() {
		return principalData;
	}

	/**
	 * @param principalData
	 *            the principalData to set
	 */
	public void setPrincipalData(PrincipalData principalData) {
		this.principalData = principalData;
	}

	@Override
	protected void dispatch(UserLoggedInHandler handler) {
		handler.onUserLoggedIn(this);
	}
}
